﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LogicUniversityBiz;

namespace LogicUniversity.clerks
{
    public partial class AddCatalogue : System.Web.UI.Page
    {

        protected void Page_PreInit(Object sender, EventArgs e)
        {
            //(Session["Role"]
            if (Session["Role"] as string != "Clerk")
            {
                Response.Redirect("~/Login.aspx");
            }

        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
               
                {
                    CatalogueMaintain cm = new CatalogueMaintain();
                    List<Catelogue> lc = new List<Catelogue>();
                    DropDownList1.Items.Add("Pencil");
                    DropDownList1.Items.Add("Envelope");
                    DropDownList1.Items.Add("Clip");
                    DropDownList1.Items.Add("Eraser");
                    DropDownList1.Items.Add("Exercise");
                    DropDownList1.Items.Add("File");
                    DropDownList1.Items.Add("Pen");
                    DropDownList1.Items.Add("Puncher");

                    DropDownList2.Items.Add("Packet");
                    DropDownList2.Items.Add("Dozen");
                    DropDownList2.Items.Add("Box");
                    DropDownList2.Items.Add("Each");
                    DropDownList2.Items.Add("Set");

                    messageLabel.Text = "";
                }               
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            CatalogueMaintain cm = new CatalogueMaintain();
            cm.addCatalogue(txtItemcode.Text,DropDownList1.SelectedItem.Value,Convert.ToInt32(txtBin.Text),
                Convert.ToInt32(txtReorderlevel.Text),Convert.ToInt32(txtReorderqty.Text),
                DropDownList2.SelectedItem.Value,txtDescrip.Text);
            messageLabel.Text = ("Catalogue insert successfully");
           Response.Redirect("MaintainCatalogueInfo.aspx");
      
           
          
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            Response.Redirect("MaintainCatalogueInfo.aspx");
        }
    }
}